import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:my_blog_flutter/app/modules/category/views/category_view.dart';
import 'package:my_blog_flutter/app/modules/home/views/home_view.dart';
import 'package:my_blog_flutter/app/modules/mine/views/mine_view.dart';

import '../controllers/tabs_controller.dart';

class TabsView extends GetView<TabsController> {
  const TabsView({super.key});
  @override
  Widget build(BuildContext context) {
    return Obx(()=>Scaffold(
      body: TabBarView(
        controller: controller.tabController,
        physics: const NeverScrollableScrollPhysics(),
        children: const <Widget>[
          HomeView(),
          CategoryView(),
          MineView(),
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        fixedColor: Colors.red,
        iconSize: 35,
        currentIndex: controller.currentIndex.value,
        type: BottomNavigationBarType.fixed,
        onTap: (index){
          controller.setCurrentIndex(index);

        },items: const [
        BottomNavigationBarItem(icon: Icon(Icons.home), label: "首页"),
        BottomNavigationBarItem(icon: Icon(Icons.category), label: "分类"),
        BottomNavigationBarItem(icon: Icon(Icons.people), label: "我的")
      ],

      ),
    )) ;
  }
}
